<?php
/**
 * Description
 * User: duanwenjie
 * Date: 2019/5/9
 * Time: 11:30 AM
 */

namespace app\index\controller;

use app\common\model\ToolModel;
use app\common\service\ExcelLibraryService;
use app\common\YujisoController;
use app\index\service\ShopwarehousecostService;
use think\Exception;

class Shopwarehousecost extends YujisoController
{
    public $param;
    public function __construct()
    {
        parent::__construct();
        $temp = $this->request->param();
        if (isset($temp['s'])) unset($temp['s']);
        $this->param = $temp;
    }

    /**
     * 获取店仓成本列表
     * @author duanwenjie
     */
    public function getList()
    {
        $param = $this->param;
        $result = ShopwarehousecostService::getList($param);
        returnJson('1','查询成功',$result['list'],$result['total']);
    }



    /**
     * 编辑/详情
     * @author duanwenjie
     */
    public function edit()
    {
        try{
            $param = $this->param;
            $id = "";
            if ($this->request->isPost()){
                returnJson(1, "");
            }else{
                $result = ShopwarehousecostService::getShopwarehousecostDetail($param);
                returnJson(1, "",$result);
            }
        }catch (Exception $e){
            trace($e->getMessage(), 'error');
            throw new Exception($e->getMessage());
        }
    }

    /**
     * 导出数据
     * @author duanwenjie
     */
    public function export()
    {
        $param = $this->param;
        $res = ShopwarehousecostService::export($param);
        exitJson($res);
    }

}